<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%
	pageContext.setAttribute("APP_PATH", request.getContextPath());
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv = "X-UA-Compatible" content = "IE=edge">
<title>警员历史信息查询</title>
<link href="${APP_PATH}/static2/css/style.css" rel="stylesheet" type="text/css" />
<link href="${APP_PATH}/static2/css/xilaxuanze.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${APP_PATH}/static2/js/jquery.js"></script>
<script src="${APP_PATH}/static2/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<link href="${APP_PATH}/static2/jquery-jbox/2.3/Skins/Bootstrap/jbox.min.css" rel="stylesheet"/>
<script src="${APP_PATH}/static2/jquery-jbox/2.3/jquery.jBox-2.3.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(function(){	
	//移到右边
	$('#add').click(function(){
		//先判断是否有选中
		if(!$("#select1 option").is(":selected")){			
			alert("请选择需要移动的选项")
		}
		//获取选中的选项，删除并追加给对方
		else{
			$('#select1 option:selected').appendTo('#select2');
		}	
	});
	
	//移到左边
	$('#remove').click(function(){
		//先判断是否有选中
		if(!$("#select2 option").is(":selected")){			
			alert("请选择需要移动的选项")
		}
		else{
			$('#select2 option:selected').appendTo('#select1');
		}
	});
	
	//全部移到右边
	$('#add_all').click(function(){
		//获取全部的选项,删除并追加给对方
		$('#select1 option').appendTo('#select2');
	});
	
	//全部移到左边
	$('#remove_all').click(function(){
		$('#select2 option').appendTo('#select1');
	});
	
	//双击选项
	$('#select1').dblclick(function(){ //绑定双击事件
		//获取全部的选项,删除并追加给对方
		$("option:selected",this).appendTo('#select2'); //追加给对方
	});
	
	//双击选项
	$('#select2').dblclick(function(){
		$("option:selected",this).appendTo('#select1');
	});
	
});
</script>
<script>  

$(function () {
	//全选或全不选
	$("#all").click(function(){   
    	if(this.checked){   
        	$("#list :checkbox").prop("checked", true);  
    	}else{   
		$("#list :checkbox").prop("checked", false);
    	}   
 	}); 
	//全选  
    $("#selectAll").click(function () {
         $("#list :checkbox,#all").prop("checked", true);  
    });  
	//全不选
    $("#unSelect").click(function () {  
         $("#list :checkbox,#all").prop("checked", false);  
    });  
    //反选 
    $("#reverse").click(function () { 
         $("#list :checkbox").each(function () {  
              $(this).prop("checked", !$(this).prop("checked"));  
         });
		 allchk();
    });
	
	//设置全选复选框
	$("#list :checkbox").click(function(){
		allchk();
	});
 
	//获取选中选项的值
	$("#getValue").click(function(){
		var valArr = new Array;
        $("#list :checkbox[checked]").each(function(i){
			valArr[i] = $(this).val();
        });
		var vals = valArr.join(',');
      	alert(vals);
    });
}); 
function allchk(){
	var chknum = $("#list :checkbox").size();//选项总个数
	var chk = 0;
	$("#list :checkbox").each(function () {  
        if($(this).prop("checked")==true){
			chk++;
		}
    });
	if(chknum==chk){//全选
		$("#all").prop("checked",true);
	}else{//不全选
		$("#all").prop("checked",false);
	}
}
</script>
<script>
$(function(){  
    $("#shanchu").click(function() {
        $("input[name='test']:checked").each(function() { // 遍历选中的checkbox
            n = $(this).parents("tr").index();  // 获取checkbox所在行的顺序
            $("table#list").find("tr:eq("+n+")").remove();
        });
    });
}); 
</script>
<script type="text/javascript">
$(document).ready(function(){
  $(".click").click(function(){
  $(".tipyuan").fadeIn(200);
  });
  
  $(".tiptop a").click(function(){
  $(".tipyuan").fadeOut(200);
});

  $(".sure").click(function(){
  $(".tipyuan").fadeOut(100);
});

  $(".cancel").click(function(){
  $(".tipyuan").fadeOut(100);
});

});
</script>
<script type="text/javascript">
$(document).ready(function(){
  $(".btnxx").click(function(){
  $(".tipjyls").fadeIn(200);
  });
  
  $(".tiptop a").click(function(){
  $(".tip").fadeOut(200);
});

  $(".sure").click(function(){
  $(".tipjyls").fadeOut(100);
});

  $(".cancel").click(function(){
  $(".tipjyls").fadeOut(100);
});

});
</script>
<script type="text/javascript">
$(document).ready(function(){
  $("#axq").click(function(){
  $("#riqi").hide();
   $("#xingqi").show();
  });
  
  
  $("#arq").click(function(){
  $("#riqi").show();
   $("#xingqi").hide();
  });
  
  
    $("#xinxi").click(function(){
  $("#xingqi").show();
   $("#riqi").hide();
  });
    
  //翻页
	var pageInfoJson=${pageInfoJson};
	build_page_nav(pageInfoJson);
 //双击行（tr）,弹出修改按钮
	$("#list tr").dblclick(function(){
		//获取双击行的checkbox的dataID
		var checkboxObj=$(this).find("input:checkbox[name='policeCheckbox']");
		var policeId=checkboxObj.attr("dataId");
		//$("#policeUpdateModal form")[0].reset();
		showPoliceInfoDetail(policeId);
		//$("#policeInfo_upodate_btn").attr("dataId",policeId);
		$("#policeUpdateModal").fadeIn(200);
	});
  
});
function to_page(n){
    $("#pageNo").val(n);
    $("#searchForm").submit();
    return false;
}
function build_page_nav(pageInfo) {
	//$("#page_info_nav").empty();
	totalrecord=pageInfo.pages;
	var ul=$("#pageInfoId");
	ul.empty();
	var firstPageLi =$("<li></li>").addClass("paginItem").append($("<a ></a>").append("首页").attr("href","javascript:;"));
	var prePageLi =$("<li></li>").addClass("paginItem").append($("<a href='javascript:;'></a>").append("&laquo;"));
	if(pageInfo.hasPreviousPage==false){
		firstPageLi.addClass("disabled");
		prePageLi.addClass("disabled");
	}else{
		firstPageLi.click(
				function(){
					to_page(1);
				}		
				);
				prePageLi.click(
						function(){
							to_page(pageInfo.pageNum-1);
						});
	}
	
	var nextPageLi =$("<li></li>").addClass("paginItem").append($("<a href='javascript:;'></a>").append("&raquo;"));
	var lastPageLi =$("<li></li>").addClass("paginItem").append($("<a href='javascript:;'></a>").append("尾页").attr("href","#"));
	if(pageInfo.hasNextPage==false){
		nextPageLi.addClass("disabled");
		lastPageLi.addClass("disabled");
	}else{
		nextPageLi.click(function(){
			to_page(pageInfo.pageNum+1);
		});
		lastPageLi.click(function(){
			to_page(pageInfo.pages);
		});
	}
	
	ul.append(firstPageLi).append(prePageLi);
	$.each(pageInfo.navigatepageNums, function(index, item) {
			var numLi = $("<li></li>").addClass("paginItem").append($("<a href='javascript:;'></a>").append(item));
			if(pageInfo.pageNum == item){
				numLi.addClass("current");
			}
			numLi.click(function(){
				to_page(item);
			});
			ul.append(numLi);
		});
	ul.append(nextPageLi).append(lastPageLi);
    ul.appendTo("#page_info_nav");
}
//查看详情
function showPoliceInfoDetail(id){
	$("#policeDetailModal form")[0].reset();
	$.ajax({
		url:"${APP_PATH}/per/policeInfo/getPolice?infoGUID="+id,
		type:"get",
		success:function(result){
			$("#policeName_update_input").val(result.policeName);
			$("#policeNo_update_input").val(result.policeNo);
			$("#inTime_update_input").val(result.inTime);
			$("#inquestRoomNo_update_input").val(result.roomInfo.roomName);
			$("#policeBringCount_update_input").val(result.policeBringCount);
			$("#curPostion_update_input").val(result.curPostion);
			$("#leaveTime_update_input").val(result.leaveTime);
			$("#leaveReason_update_input").val(result.leaveReason);
			$("#policeOrg_update_input").val(result.policeOrg);
			
			//打开详情模态框
			$("#policeDetailModal").fadeIn(200);
		}
	});
}
</script>
<script type="text/javascript">

function bxwcklj(id) {
		var url = "${APP_PATH}/per/policeInfo/checkPolicePathView?policeInfoGUID="+ id; //转向网页的地址; 
		 $.jBox.open(
			        "iframe:"+url, 
			        "警员路径查看", 1000, 780, 
			        {id:'addTradeProject', 
			        	top: '30px',
			        	buttons: {"关闭":true}, 
			        	iframeScrolling: 'yes',
			        	showClose: true
			        }
			    ); 
		/* var name = 'add'; //网页名称，可为空; 
		var iWidth = 1000; //弹出窗口的宽度; 
		var iHeight = 700; //弹出窗口的高度; 
		//获得窗口的垂直位置 
		var iTop = (window.screen.availHeight - 30 - iHeight) / 2;
		//获得窗口的水平位置 
		var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
		window.open(url,name,'height='
								+ iHeight
								+ ',,innerHeight='
								+ iHeight
								+ ',width='
								+ iWidth
								+ ',innerWidth='
								+ iWidth
								+ ',top='
								+ iTop
								+ ',left='
								+ iLeft
								+ ',status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no');
 */
	}
</script>
<style type="text/css">
.disabled{
    cursor: not-allowed;
    background-color: #eee;
    opacity: 1;
    color: #737373 !important;
}
.disabled a{
color: #737373 !important;}
.textleft{
text-align: right;
padding-right:3px;
}
   .title{ 
    text-align: left !important;
    border-bottom: #999 1px solid;
    padding-top:0 !important; 
    height:15px !important; 
    }
     .title1{ 
    text-align: left !important;
    border-bottom: #999 1px solid;
    height:15px !important; 
    }
    .tip{
      height:280px;
    }
</style>
</head>

<body>
<div class="place">
  <ul class="placeul">
    <li>警员历史信息查询</li>
  </ul>
</div>
<div class="rightinfo">
	<div class="tools">
		<form:form id="searchForm" modelAttribute="policeInfo" action="${APP_PATH}/per/policeInfo/list" method="post">
	    <input id="isLeave" name="isLeave" type="hidden" value="1"/>
	    <input id="pageNo" name="pageNo" type="hidden" />
	    <input id="hisHistoryFlg" name="hisHistoryFlg" type="hidden" value="1"/>
	  姓名
	 <input name="policeName" type="text"  maxlength="10" ${policeInfo.policeName}"/>
	   警号
	   <input name="policeNo" type="text" maxlength="20" value="${policeInfo.policeNo}"/>
	   时间
	  <input name="inTime" type="text" value="${policeInfo.inTime}" maxlength="20" class="input-medium Wdate required" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
	  
	  <img src="${APP_PATH}/static2/images/chaxun.jpg" width="75" height="35" style=" vertical-align:middle" onclick="to_page(1)"/>
	  <div style=" width:100; height:50; background-color:#000"></div>
	  </form:form>
    </div>
	<table class="imgtable" id="list">
					<tr class="imgtable1">
						<th width="60px;">序号</th>
						<th width="60px;">选择</th>
						<th>姓名</th>
						<th>警号</th>
						<th>询问室</th>
						<th>登记时间</th>
						<th>确认离开</th>
					</tr>
				<c:forEach items="${pageInfo.list}" var="policeInfo" varStatus="pageList">
					<tr>
					    <td>${(pageInfo.pageNum - 1) * pageInfo.pageSize + pageList.index + 1}</td>
						<td class="imgtd">
							<input type="checkbox" name="policeCheckbox" dataId="${policeInfo.infoGUID}"></td>
						<td>${policeInfo.policeName}</td>
						<td>${policeInfo.policeNo}</td>
						<td>${policeInfo.roomInfo.roomName}</td>
						<td>${policeInfo.inTime}</td>
						 <td><input name="button" type="button" class="btnxx" id="button"
						onclick="showPoliceInfoDetail('${policeInfo.infoGUID}')" value="详细信息" />
						 <input name="button" type="button"  onclick="bxwcklj('${policeInfo.infoGUID}')"  class="btn" id="button" value="查看路径" /></td>
					</tr>
					</c:forEach>
				</table>
	<div class="pagin">
  			<div class="message">
				当前显示第&nbsp;<i class="blue">${pageInfo.pageNum}&nbsp;</i>页,共<i class="blue">${pageInfo.pages}</i>页,共<i class="blue">${pageInfo.total}</i>条记录，
			</div>
			<ul id="pageInfoId" class="paginList">
			    <li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>
			    <li class="paginItem"><a href="javascript:;">1</a></li>
			    <li class="paginItem current"><a href="javascript:;">2</a></li>
			    <li class="paginItem"><a href="javascript:;">3</a></li>
			    <li class="paginItem"><a href="javascript:;">4</a></li>
			    <li class="paginItem"><a href="javascript:;">5</a></li>
			    <li class="paginItem more"><a href="javascript:;">...</a></li>
			    <li class="paginItem"><a href="javascript:;">10</a></li>
			    <li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>
  			</ul>
	 </div>
	</div>
<!-- 详情模态框 -->
<div class="tip" id="policeDetailModal" >
  <div class="tiptop">
  	<span>警员信息详情</span><a></a></div>
  <form>
  <table width="650" border="1" class="zdgl" style="margin: auto;text-align: left;">
    <tr>
      <td colspan="9" >基本信息：</td>
    </tr>
     <tr>
      <td class="textleft">姓名</td>
      <td colspan="2"><input name="policeName" type="text" readonly="readonly" id="policeName_update_input"/></td>
      <td class="textleft" >警号</td>
      <td colspan="2"><input name="policeNo" type="text" readonly="readonly" id="policeNo_update_input"/></td>
      <td class="textleft">登记时间</td>
      <td colspan="2"><input name="inTime" type="text" readonly="readonly" id="inTime_update_input"/></td>
    </tr>
     <tr>
      <td class="textleft">询问室</td>
      <td colspan="2">
      	<input name="inquestRoomNo" type="text"  readonly="readonly" id="inquestRoomNo_update_input"/>
      </td>
      <td class="textleft">带领人数</td>
      <td colspan="2" ><input name="policeBringCount" type="text"  readonly="readonly" id="policeBringCount_update_input"/>
      <td class="textleft">当前位置</td>
      <td  colspan="2" ><input name="curPostion" type="text" readonly="readonly" id="curPostion_update_input"/></td>
    </tr>
    <tr>
      <td class="textleft">离开时间</td>
      <td colspan="2"><input name="leaveTime" type="text" readonly="readonly" id="leaveTime_update_input"/></td>
      <td class="textleft">离开原因</td>
      <td colspan="2" ><input name="leaveReason" type="text"readonly="readonly" id="leaveReason_update_input"/></td>
      <!-- <td class="textleft">处理结果</td>
      <td  colspan="2"><input name="input4" type="text" readonly="readonly" id="result_update_input"/></td>    
 -->    <td  colspan="2"></td>
 </tr>
    <tr>
      <td class="textleft">所属单位</td>
      <td  colspan="5">
        <input name="policeOrg" type="text" style=" width:347px" readonly="readonly" id="policeOrg_update_input"/>
       </td>
       <td colspan="3"></td>
    </tr>
  </table>
  </form>
</div>
</body>
</html>
